<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%@ include file="/pub/includ.jsp"%>
<%@ page import="com.wing.cms.domain.*"%>
<%@ page import="com.wing.common.util.*,java.util.*"%>
<script type="text/javascript">
	$(document).ready(function(){
	        $.formValidator.initConfig({formid:"portlet1form",alertmessage:false,onerror:function(msg){alert(msg)}});
			$("#menuchannelid").formValidator().inputValidator({min:1,onerror:"必须选择一个根频道"});
            
            $("#title").formValidator({empty:"true"}).inputValidator({min:1,max:250,onerror:"portlet名称过长"});
            $("#portletwidth").formValidator().inputValidator({min:0,max:1500,type:"value",onerror:"portlet宽度必须是0-1500之间的数组"});
            $("#portletheight").formValidator().inputValidator ({min:0,max:5000,type:"value",onerror:"portlet高度必须是0-5000之间的数组"});
	});
	
	var save = function(){
		var flag = "failure";
		if($.formValidator.pageIsValid()){
			var options = {
				type: 'POST',
				async: false,
				dataType: 'content-type',
				success: function(msg) {
						flag = "success";
				}
			}
			$('#portlet1form').ajaxSubmit(options);
		}
		return flag;
	 }

	function call_selchannel(oId,oName){
		selChannel("{oId:\'"+oId+"\',oName:\'"+oName+"\',width:\'300\',height:\'300\',type:\'one\'}",window);
	}
	
	function selectColor(){
            opendailog("{src:'<%=path %>/resources/component/farbtastic/demo1.jsp?color="+$('#titlecolor').val().substring(1,$('#titlecolor').val().length)+"',title:'选取颜色',width:320,height:300,savefunc:'savefunc1'}",window);
	}
	
	function savefunc1(frame){
		var retv = frame.contentWindow.save();
		$('#titlecolor').val(retv);
		return "success";
	}
	
	function selectImage(){
		opendailog("{src:'<%=path %>/res/get/selectImageIndex',title:'选取图片',width:600,height:400,savefunc:'savefunc2'}",window);
	}
	function savefunc2(frame){
		var retv = frame.contentWindow.save();
		if(retv){
			$('#titlepic').val(retv);
			return "success";		
		}
	}
</script>
<form id="portlet1form"  action="<%=path%>/cms/portlet/saveportlet1" method="post" target="_self">
<table><tr><td height="2px"></td></tr></table>
<table align="center" border="0" cellpadding="0" cellspacing="1" class="table_nbw" >
	<thead class="th_nbw">
	<tr>
		<td colspan="2" align="center"><strong>菜单展现设置</strong></td>
	</tr>
	</thead>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">根频道</td>
		<td align="left" style="background-color:fff">
			<input class="textfiled_nbw"  type="text" id="showChannelTitle" readonly="readonly" name="showChannelTitle" value="${portlet1.showChannelTitle}">
			<input type="hidden" id="menuchannelid" name="menuchannelid" value="${portlet1.menuchannelid}">
			<input type="button" value="选择" onclick="call_selchannel('menuchannelid','showChannelTitle')"/>
		</td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">展现频道层次</td>
		<td align="left" style="background-color:fff">&nbsp;
			<select name="showlevel" style="width:80">
				<option value="1" ${'1'==portlet1.showlevel?'selected':''}>1</option>
				<option value="2" ${'2'==portlet1.showlevel?'selected':''}>2</option>
				<option value="3" ${'3'==portlet1.showlevel?'selected':''}>3</option>
				<option value="4" ${'4'==portlet1.showlevel?'selected':''}>4</option>
			</select>
		</td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">是否弹开功能页面</td>
		<td align="left" style="background-color:fff">&nbsp;
			<select name="isopened" style="width:80">
				<option value="0" ${'0'==portlet1.isopened?'selected':''}>&nbsp;弹开</option>
				<option value="1" ${'1'==portlet1.isopened?'selected':''}>本页面</option>
			</select>
		</td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">展示状态</td>
		<td align="left" style="background-color:fff">&nbsp;
			<select  name="showstate" style="width:80" >
				<option value="0" ${'0'==portlet1.showstate?'selected':''}>禁用</option>
				<option value="1" ${'1'==portlet1.showstate?'selected':''}>启用</option>
			</select>
		</td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">模板</td>
		<td align="left" style="background-color:fff">&nbsp;
			<select name="templateid" style="width:120">
			<c:forEach var="template" items="${templateList}"> 
				<option value='${template.id}' ${template.id==portlet1.templateid?'selected':''}>
					${template.name}
				</option> 
			</c:forEach> 
			</select>
		</td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">portlet名称</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="title" name="title" value="${portlet1.title}"></td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">portlet名称展示类型</td>
		<td align="left" style="background-color:fff">&nbsp;
			<label><input type="radio" value="0" checked="checked" name="titletype" />样式</lable>
			&nbsp;&nbsp;&nbsp;&nbsp; 
			<label><input type="radio" value="1" ${portlet1.titletype=="1"?'checked=checked':''} name="titletype" />图片</label>
		</td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">portlet名称样式</td>
		<td align="left" style="background-color:fff">&nbsp;
			<select name="titlecolor" style="width:120">
				<option value='portal_title1' ${portlet1.titlecolor=='portal_title1'?'selected':''}>标题1</option> 
				<option value='portal_title2' ${portlet1.titlecolor=='portal_title2'?'selected':''}>标题2</option> 
				<option value='portal_title3' ${portlet1.titlecolor=='portal_title3'?'selected':''}>标题3</option> 
				<option value='portal_title4' ${portlet1.titlecolor=='portal_title4'?'selected':''}>标题4</option> 
				<option value='portal_title5' ${portlet1.titlecolor=='portal_title5'?'selected':''}>标题5</option> 
				<option value='portal_title6' ${portlet1.titlecolor=='portal_title6'?'selected':''}>标题6</option> 
			</select>
		</td>
	</tr>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">portlet名称图片</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="titlepic" name="titlepic" value="${portlet1.titlepic}">
			<input type = "button"  value = "选择"  onclick = "selectImage();">
		</td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">portlet宽度</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="portletwidth" name="portletwidth" value="${portlet1.portletwidth}"></td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">portlet高度</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="portletheight" name="portletheight" value="${portlet1.portletheight}"></td>
	</tr>
</table>

<input type="hidden" name="id" value="${portlet1.id}" />
<input type="hidden" id="portletype" name="portletype" value="menu">
<input type="hidden" name="horderChannelId" value="${param.horderChannelId}"/>
<input type="hidden" name="placeholderId" value="${param.placeholderId}"/>
</form>


